# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-06-07
# @File : 14_hook_session_id.py

import frida
import sys
from frida.core import Device

rdev = frida.get_remote_device()

# session = rdev.attach("tv.danmaku.bili")
session = rdev.attach("哔哩哔哩")

scr = """
Java.perform(function () {
    var a = Java.use("com.bilibili.api.a");

    a.o.implementation = function(arg0){   
       console.log("obj=",arg0);
       console.log("obj=",JSON.stringify(arg0));
       this.o(arg0);
       console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new()));
    }

});
"""
script = session.create_script(scr)

script.load()
sys.stdin.read()